<template>
  <modal-box :show="show" @close="$emit('close')">
    <div class="menu-modal">
      <h2>新建清单</h2>
      <input type="text" placeholder="输入清单名" v-model.trim="name">
      <button @click="save">完成</button>
    </div>
  </modal-box>
</template>

<script>
import ModalBox from "./ModalBox.vue";
export default {
  components: { ModalBox },
  props: {
    show: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      name: '', // 菜单名称
    }
  },
  methods: {
    save() {
      this.$emit('add-menu', this.name);
      // this.name = '';
    }
  }
};
</script>
